Hi, I am new in dxl programming, i try to write my first programm that search object in another model and print if not found (new_Name) , print without_Name when curren object empty is , when objct match with another modul hole Name _descrption . but i get error the progrmm give all the object by new_Name kann anyone help
pragma runLim, 0
Module m = current filtering off
string modulNr = "006fe649" // Namelist if (null mPosition) mPosition = read(fullName(ModItem), false, true)
int without_Name = 0
else if (o."ccc_Name" != o_Namelist."ccc_Name") {
new_Name = new_Name + 1 print wihtout_Name print new_Name }
Thx
Control17 - Wed Jul 12 03:00:55 EDT 2017 |
Re: Search value in another modul Hello!
First of all I'd suggest using Notepad++ for the text editing. It turned out pretty fast, that the number of "{" and "}" characters doesn't match. 3 } are missing at least. Also please if possible, could you share the entire script? The declarations are missing, they could be helpful.
Also this part: if (null o."ccc_Name" " ") I'd suggest changing it to: if (o."ccc_Name" "" == "")
Also I found that one of the print rows is wrong, this has a typo: print wihtout_Name print without_Name //it should be like this
For better readibility on the forum, I suggest using the Code bracket, 6th icon on the Rich Text editor. (at first I didn't know about it either). Later I'll help more, sorry about being short now.
Best regards, Peter |
Re: Search value in another modul HPM2BP - Fri Jul 14 08:51:11 EDT 2017 Hello!
First of all I'd suggest using Notepad++ for the text editing. It turned out pretty fast, that the number of "{" and "}" characters doesn't match. 3 } are missing at least. Also please if possible, could you share the entire script? The declarations are missing, they could be helpful.
Also this part: if (null o."ccc_Name" " ") I'd suggest changing it to: if (o."ccc_Name" "" == "")
Also I found that one of the print rows is wrong, this has a typo: print wihtout_Name print without_Name //it should be like this
For better readibility on the forum, I suggest using the Code bracket, 6th icon on the Rich Text editor. (at first I didn't know about it either). Later I'll help more, sorry about being short now.
Best regards, Peter Thank you
Best regards,
|
Re: Search value in another modul HPM2BP - Fri Jul 14 08:51:11 EDT 2017 Hello!
First of all I'd suggest using Notepad++ for the text editing. It turned out pretty fast, that the number of "{" and "}" characters doesn't match. 3 } are missing at least. Also please if possible, could you share the entire script? The declarations are missing, they could be helpful.
Also this part: if (null o."ccc_Name" " ") I'd suggest changing it to: if (o."ccc_Name" "" == "")
Also I found that one of the print rows is wrong, this has a typo: print wihtout_Name print without_Name //it should be like this
For better readibility on the forum, I suggest using the Code bracket, 6th icon on the Rich Text editor. (at first I didn't know about it either). Later I'll help more, sorry about being short now.
Best regards, Peter Hallo Peter , i get error in this part :
else if (o."ccc_Name" != o_Namelist."ccc_Name")
{
new_Name = new_Name + 1
}
it show always 0 ID , in this loop search current object in another model when not found should give this as new_Name !
can u help !
Best regards, Neven
|
Re: Search value in another modul Control17 - Tue Jul 18 02:21:47 EDT 2017 Hallo Peter , i get error in this part :
else if (o."ccc_Name" != o_Namelist."ccc_Name")
{
new_Name = new_Name + 1
}
it show always 0 ID , in this loop search current object in another model when not found should give this as new_Name !
can u help !
Best regards, Neven
Hello!
First of all, I'd suggets adding two quotation marks after every attribute, like this: else if (o."CCC_Name" "" != o_Namelist."ccc_Name" "") //This is the correct form else if (o."CCC_Name" != o_Namelist."ccc_Name" ) //This is the original, wrong form First let's see how this goes. |
Re: Search value in another modul HPM2BP - Tue Jul 18 05:03:02 EDT 2017 Hello!
First of all, I'd suggets adding two quotation marks after every attribute, like this: else if (o."CCC_Name" "" != o_Namelist."ccc_Name" "") //This is the correct form else if (o."CCC_Name" != o_Namelist."ccc_Name" ) //This is the original, wrong form First let's see how this goes. still 0 ID , no change !
Best regards, Neven |
Re: Search value in another modul Could you please post the current code you are using? I can only assume what it looks like. |
Re: Search value in another modul HPM2BP - Tue Jul 18 08:27:24 EDT 2017 Could you please post the current code you are using? I can only assume what it looks like. Hello,
pragma runLim, 0
Module m = current
Object o = current
Object o_Namelist
filtering off
string modulNr = "0025f119" // Namelist
Item ModItem = itemFromID(modulNr)
Module mName = module ModItem
if (null mName) mName = read(fullName(ModItem), false, true)
int without_Name = 0
int new_Name = 0
//
for o in m do
{
//
string Name_abbr. = o."doors_Name_abbr."
//
if(Name_abbr. == "")
{
o."Name_descrp" = ""
}
if(Name_abbr. != "")
{
//
for o_Namelist in mName do
//
string Name_abbr.NameL = o_Namelist."doors_Name_abbr."
if (Name_abbr. == Name_abbr.NameL)
{
//
string a = o_Namelist."Name_descrp"
string b = o."Name_descrp"
if(b != a)
{
o."Name_descrp" = a
}
}
}
else if (o."doors_Name_abbr." "" == "")
{
without_Name = without_Name + 1
print "ID: " o."Absolute Number" "without name" "\n"
}
else if (o."doors_Name_abbr." "" != o_Namelist."doors_Name_abbr." "" )
{
new_Name = new_Name + 1
print "ID: " o."Absolute Number" "new name" "\n"
}
}
//
print without_Name " IDs without Name" "\n"
print new_Name " IDs not in Name list"
|
Re: Search value in another modul Control17 - Wed Jul 19 02:04:38 EDT 2017 Hello,
pragma runLim, 0
Module m = current
Object o = current
Object o_Namelist
filtering off
string modulNr = "0025f119" // Namelist
Item ModItem = itemFromID(modulNr)
Module mName = module ModItem
if (null mName) mName = read(fullName(ModItem), false, true)
int without_Name = 0
int new_Name = 0
//
for o in m do
{
//
string Name_abbr. = o."doors_Name_abbr."
//
if(Name_abbr. == "")
{
o."Name_descrp" = ""
}
if(Name_abbr. != "")
{
//
for o_Namelist in mName do
//
string Name_abbr.NameL = o_Namelist."doors_Name_abbr."
if (Name_abbr. == Name_abbr.NameL)
{
//
string a = o_Namelist."Name_descrp"
string b = o."Name_descrp"
if(b != a)
{
o."Name_descrp" = a
}
}
}
else if (o."doors_Name_abbr." "" == "")
{
without_Name = without_Name + 1
print "ID: " o."Absolute Number" "without name" "\n"
}
else if (o."doors_Name_abbr." "" != o_Namelist."doors_Name_abbr." "" )
{
new_Name = new_Name + 1
print "ID: " o."Absolute Number" "new name" "\n"
}
}
//
print without_Name " IDs without Name" "\n"
print new_Name " IDs not in Name list"
This runs without a syntax error? // string Name_abbr. = o."doors_Name_abbr." I am wondering about the trailing "." in the string variable name! |
Re: Search value in another modul Control17 - Wed Jul 19 02:04:38 EDT 2017 Hello,
pragma runLim, 0
Module m = current
Object o = current
Object o_Namelist
filtering off
string modulNr = "0025f119" // Namelist
Item ModItem = itemFromID(modulNr)
Module mName = module ModItem
if (null mName) mName = read(fullName(ModItem), false, true)
int without_Name = 0
int new_Name = 0
//
for o in m do
{
//
string Name_abbr. = o."doors_Name_abbr."
//
if(Name_abbr. == "")
{
o."Name_descrp" = ""
}
if(Name_abbr. != "")
{
//
for o_Namelist in mName do
//
string Name_abbr.NameL = o_Namelist."doors_Name_abbr."
if (Name_abbr. == Name_abbr.NameL)
{
//
string a = o_Namelist."Name_descrp"
string b = o."Name_descrp"
if(b != a)
{
o."Name_descrp" = a
}
}
}
else if (o."doors_Name_abbr." "" == "")
{
without_Name = without_Name + 1
print "ID: " o."Absolute Number" "without name" "\n"
}
else if (o."doors_Name_abbr." "" != o_Namelist."doors_Name_abbr." "" )
{
new_Name = new_Name + 1
print "ID: " o."Absolute Number" "new name" "\n"
}
}
//
print without_Name " IDs without Name" "\n"
print new_Name " IDs not in Name list"
Hello!
At line 34 you have a missing { bracket. You are not specifying what the for loop consists of. Please fix it and post the code again. I can only guess what the for loop consists of, because now you have an equal number of { and } characters.
Best regards, Peter |
Re: Search value in another modul thsturm - Wed Jul 19 03:13:59 EDT 2017 This runs without a syntax error? // string Name_abbr. = o."doors_Name_abbr." I am wondering about the trailing "." in the string variable name!
sorry , i have chnage the name (it was abbreviation ) and i make it abbr.
pragma runLim, 0
Module m = current
Object o = current
Object o_Namelist
filtering off
string modulNr = "0025f119" // Namelist
Item ModItem = itemFromID(modulNr)
Module mName = module ModItem
if (null mName) mName = read(fullName(ModItem), false, true)
int without_Name = 0
int new_Name = 0
//
for o in m do
{
//
string Name_abbr = o."doors_Name_abbr"
//
if(Name_abbr == "")
{
o."Name_descrp" = ""
}
if(Name_abbr != "")
{
//
for o_Namelist in mName do
//
string Name_abbrNameL = o_Namelist."doors_Name_abbr"
if (Name_abbr == Name_abbrNameL)
{
//
string a = o_Namelist."Name_descrp"
string b = o."Name_descrp"
if(b != a)
{
o."Name_descrp" = a
}
}
}
else if (o."doors_Name_abbr" "" == "")
{
without_Name = without_Name + 1
print "ID: " o."Absolute Number" "without name" "\n"
}
else if (o."doors_Name_abbr" "" != o_Namelist."doors_Name_abbr" "" )
{
new_Name = new_Name + 1
print "ID: " o."Absolute Number" "new name" "\n"
}
}
//
print without_Name " IDs without Name" "\n"
print new_Name " IDs not in Name list"
|
Re: Search value in another modul HPM2BP - Wed Jul 19 03:29:48 EDT 2017 Hello!
At line 34 you have a missing { bracket. You are not specifying what the for loop consists of. Please fix it and post the code again. I can only guess what the for loop consists of, because now you have an equal number of { and } characters.
Best regards, Peter Hello Peter , I have fix it , still show 0 ID not in Namelist , it should be 1 ID !
pragma runLim, 0
Module m = current
Object o = current
Object o_Namelist
filtering off
string modulNr = "0025f119" // Namelist
Item ModItem = itemFromID(modulNr)
Module mName = module ModItem
if (null mName) mName = read(fullName(ModItem), false, true)
int without_Name = 0
int new_Name = 0
//
for o in m do
{
//
string Name_abbr = o."doors_Name_abbr"
//
if(Name_abbr == "")
{
o."Name_descrp" = ""
}
if(Name_abbr != "")
{
//
for o_Namelist in mName do {
string Name_abbrNameL = o_Namelist."doors_Name_abbr"
if (Name_abbr == Name_abbrNameL)
{
//
string a = o_Namelist."Name_descrp"
string b = o."Name_descrp"
if(b != a)
{
o."Name_descrp" = a
}
}
}
}
else if (o."doors_Name_abbr" "" == "")
{
without_Name = without_Name + 1
print "ID: " o."Absolute Number" "without name" "\n"
}
else if (o."doors_Name_abbr" "" != o_Namelist."doors_Name_abbr" "" )
{
new_Name = new_Name + 1
print "ID: " o."Absolute Number" "new name" "\n"
}
}
//
print without_Name " IDs without Name" "\n"
print new_Name " IDs not in Name list"
Thx ,
Neven |
Re: Search value in another modul Control17 - Wed Jul 19 05:04:39 EDT 2017 Hello Peter , I have fix it , still show 0 ID not in Namelist , it should be 1 ID !
pragma runLim, 0
Module m = current
Object o = current
Object o_Namelist
filtering off
string modulNr = "0025f119" // Namelist
Item ModItem = itemFromID(modulNr)
Module mName = module ModItem
if (null mName) mName = read(fullName(ModItem), false, true)
int without_Name = 0
int new_Name = 0
//
for o in m do
{
//
string Name_abbr = o."doors_Name_abbr"
//
if(Name_abbr == "")
{
o."Name_descrp" = ""
}
if(Name_abbr != "")
{
//
for o_Namelist in mName do {
string Name_abbrNameL = o_Namelist."doors_Name_abbr"
if (Name_abbr == Name_abbrNameL)
{
//
string a = o_Namelist."Name_descrp"
string b = o."Name_descrp"
if(b != a)
{
o."Name_descrp" = a
}
}
}
}
else if (o."doors_Name_abbr" "" == "")
{
without_Name = without_Name + 1
print "ID: " o."Absolute Number" "without name" "\n"
}
else if (o."doors_Name_abbr" "" != o_Namelist."doors_Name_abbr" "" )
{
new_Name = new_Name + 1
print "ID: " o."Absolute Number" "new name" "\n"
}
}
//
print without_Name " IDs without Name" "\n"
print new_Name " IDs not in Name list"
Thx ,
Neven Hi Neven, in line 55 you ask for an attribute of o_Namelist, but you are outside the loop "for o_Namelist.." which goes from line 34 to 48. So, in line 55, o_Namelist will always be the last object of mName. Perhaps you want to draw e.g. a Nassi-Shneiderman diagram of your program to determine which loops you need, which decisions need to be done and which use cases appear and how to deal with them |
Re: Search value in another modul Mike.Scharnow - Wed Jul 19 05:22:45 EDT 2017 Hi Neven, in line 55 you ask for an attribute of o_Namelist, but you are outside the loop "for o_Namelist.." which goes from line 34 to 48. So, in line 55, o_Namelist will always be the last object of mName. Perhaps you want to draw e.g. a Nassi-Shneiderman diagram of your program to determine which loops you need, which decisions need to be done and which use cases appear and how to deal with them Agreed, you are right!
I'd suggest the usage of a boolean like this, and rearranging the if parts:
pragma runLim, 0
Module m = current
Object o = current
Object o_Namelist
filtering off
string modulNr = "0025f119" // Namelist
Item ModItem = itemFromID(modulNr)
Module mName = module ModItem
if (null mName) mName = read(fullName(ModItem), false, true)
int without_Name = 0
int new_Name = 0
bool foundMatch = false
for o in m do {
foundMatch = false
string Name_abbr = o."doors_Name_abbr"
if(Name_abbr == ""){
o."Name_descrp" = ""
}
if(Name_abbr != ""){
for o_Namelist in mName do {
string Name_abbrNameL = o_Namelist."doors_Name_abbr"
if (Name_abbr == Name_abbrNameL){
foundMatch = true
string a = o_Namelist."Name_descrp"
string b = o."Name_descrp"
if(b != a){
o."Name_descrp" = a
}
}
}
}
if (foundMatch == true){
new_Name = new_Name + 1
print "ID: " o."Absolute Number" "new name" "\n"
}
else{
without_Name = without_Name + 1
print "ID: " o."Absolute Number" "without name" "\n"
}
}
//
print without_Name " IDs without Name" "\n"
print new_Name " IDs not in Name list"
|
Re: Search value in another modul HPM2BP - Wed Jul 19 05:57:37 EDT 2017 Agreed, you are right!
I'd suggest the usage of a boolean like this, and rearranging the if parts:
pragma runLim, 0
Module m = current
Object o = current
Object o_Namelist
filtering off
string modulNr = "0025f119" // Namelist
Item ModItem = itemFromID(modulNr)
Module mName = module ModItem
if (null mName) mName = read(fullName(ModItem), false, true)
int without_Name = 0
int new_Name = 0
bool foundMatch = false
for o in m do {
foundMatch = false
string Name_abbr = o."doors_Name_abbr"
if(Name_abbr == ""){
o."Name_descrp" = ""
}
if(Name_abbr != ""){
for o_Namelist in mName do {
string Name_abbrNameL = o_Namelist."doors_Name_abbr"
if (Name_abbr == Name_abbrNameL){
foundMatch = true
string a = o_Namelist."Name_descrp"
string b = o."Name_descrp"
if(b != a){
o."Name_descrp" = a
}
}
}
}
if (foundMatch == true){
new_Name = new_Name + 1
print "ID: " o."Absolute Number" "new name" "\n"
}
else{
without_Name = without_Name + 1
print "ID: " o."Absolute Number" "without name" "\n"
}
}
//
print without_Name " IDs without Name" "\n"
print new_Name " IDs not in Name list"
it does not work, he gives all the object as new _Name
|
Re: Search value in another modul Found the problem, it's about not using double quotation marks ("") after requesting the values from object attributes. Try it like this:
pragma runLim, 0
Module m = current
Object o = current
Object o_Namelist
filtering off
string modulNr = "0025f119" // Namelist
Item ModItem = itemFromID(modulNr)
Module mName = module ModItem
if (null mName) mName = read(fullName(ModItem), false, true)
int without_Name = 0
int new_Name = 0
bool foundMatch = false
for o in m do {
foundMatch = false
string Name_abbr = o."doors_Name_abbr" ""
if(Name_abbr == ""){
o."Name_descrp" = ""
}
if(Name_abbr != ""){
for o_Namelist in mName do {
string Name_abbrNameL = o_Namelist."doors_Name_abbr" ""
if (Name_abbr == Name_abbrNameL){
foundMatch = true
string a = o_Namelist."Name_descrp" ""
string b = o."Name_descrp" ""
if(b != a){
o."Name_descrp" = a
}
}
}
}
if (foundMatch == true){
new_Name = new_Name + 1
print "ID: " o."Absolute Number" "new name" "\n"
}
else{
without_Name = without_Name + 1
print "ID: " o."Absolute Number" "without name" "\n"
}
}
//
print without_Name " IDs without Name" "\n"
print new_Name " IDs not in Name list"
|
Re: Search value in another modul HPM2BP - Fri Jul 21 07:19:20 EDT 2017 Found the problem, it's about not using double quotation marks ("") after requesting the values from object attributes. Try it like this:
pragma runLim, 0
Module m = current
Object o = current
Object o_Namelist
filtering off
string modulNr = "0025f119" // Namelist
Item ModItem = itemFromID(modulNr)
Module mName = module ModItem
if (null mName) mName = read(fullName(ModItem), false, true)
int without_Name = 0
int new_Name = 0
bool foundMatch = false
for o in m do {
foundMatch = false
string Name_abbr = o."doors_Name_abbr" ""
if(Name_abbr == ""){
o."Name_descrp" = ""
}
if(Name_abbr != ""){
for o_Namelist in mName do {
string Name_abbrNameL = o_Namelist."doors_Name_abbr" ""
if (Name_abbr == Name_abbrNameL){
foundMatch = true
string a = o_Namelist."Name_descrp" ""
string b = o."Name_descrp" ""
if(b != a){
o."Name_descrp" = a
}
}
}
}
if (foundMatch == true){
new_Name = new_Name + 1
print "ID: " o."Absolute Number" "new name" "\n"
}
else{
without_Name = without_Name + 1
print "ID: " o."Absolute Number" "without name" "\n"
}
}
//
print without_Name " IDs without Name" "\n"
print new_Name " IDs not in Name list"
Hello , i tried stll give all the IDs as new name i just want to know which Id is not in the another module "new name" ?
Thx
|
Re: Search value in another modul Control17 - Mon Jul 24 02:37:03 EDT 2017 Hello , i tried stll give all the IDs as new name i just want to know which Id is not in the another module "new name" ?
Thx
Hello,
If you told me right away this was your intention, we would have already finished :) Let's try it like this:
pragma runLim, 0
Module m = current
Object o = current
Object o_Namelist
filtering off
string modulNr = "0025f119" // Namelist
Item ModItem = itemFromID(modulNr)
Module mName = module ModItem
if (null mName) mName = read(fullName(ModItem), false, true)
int new_Name = 0
int without_Name = 0
bool foundMatch = false
string oName = ""
string pairName = ""
for o in m do {
foundMatch = false
oName = o."doors_Name_abbr" ""
if(oName != ""){
for o_Namelist in mName do {
pairName = o_Namelist."doors_Name_abbr" ""
if (oName == pairName){
foundMatch = true
}
}
}
if (foundMatch == true){
new_Name = new_Name + 1
print "ID: " o."Absolute Number" "new name" "\n"
}
else{
without_Name = without_Name + 1
print "ID: " o."Absolute Number" "without name" "\n"
}
}
//
print without_Name " IDs without Name" "\n"
print new_Name " IDs not in Name list"
|
Re: Search value in another modul HPM2BP - Mon Jul 24 03:04:41 EDT 2017 Hello,
If you told me right away this was your intention, we would have already finished :) Let's try it like this:
pragma runLim, 0
Module m = current
Object o = current
Object o_Namelist
filtering off
string modulNr = "0025f119" // Namelist
Item ModItem = itemFromID(modulNr)
Module mName = module ModItem
if (null mName) mName = read(fullName(ModItem), false, true)
int new_Name = 0
int without_Name = 0
bool foundMatch = false
string oName = ""
string pairName = ""
for o in m do {
foundMatch = false
oName = o."doors_Name_abbr" ""
if(oName != ""){
for o_Namelist in mName do {
pairName = o_Namelist."doors_Name_abbr" ""
if (oName == pairName){
foundMatch = true
}
}
}
if (foundMatch == true){
new_Name = new_Name + 1
print "ID: " o."Absolute Number" "new name" "\n"
}
else{
without_Name = without_Name + 1
print "ID: " o."Absolute Number" "without name" "\n"
}
}
//
print without_Name " IDs without Name" "\n"
print new_Name " IDs not in Name list"
Thank u , i did some changes to this code and it work now .
Best regards ,
|